using System.Reflection;
using CMS.Entity;
using Microsoft.EntityFrameworkCore;

namespace CMS.EFCore;

public class MyDbContext(DbContextOptions<MyDbContext> options) : DbContext(options) {
    public DbSet<User> Users { get; set; }
    public DbSet<Article> Articles { get; set; }
    public DbSet<ArticleCategory> ArticleCategories { get; set; }
    public DbSet<ArticleComment> ArticleComments { get; set; }
    public DbSet<SensitiveWord> SensitiveWords { get; set; }
    public DbSet<ImageServer> ImageServers { get; set; }
    public DbSet<Image> Images { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder) {
        base.OnModelCreating(modelBuilder);
        modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);
    }
}